/*
 * RMI demo
 * Spring 2013 TCSS 558
 * Daniel M. Zimmerman
 */

package rmi;

import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;

/**
 * An interface for a Remote map.
 * 
 * @author Daniel M. Zimmerman
 * @version Spring 2013
 */
public interface RemoteMap extends Remote
{
  /**
   * Puts the specified key-value mapping into the map.
   * 
   * @param the_key The key.
   * @param the_value The value.
   * @return the previous value that was mapped to the key,
   * if any.
   * @throws RemoteException if something goes wrong with RMI.
   */
  Serializable put(Serializable the_key, Serializable the_value)
    throws RemoteException;
  
  /**
   * Returns the value corresponding to the specified key in the
   * map.
   * 
   * @param the_key The key.
   * @return The value mapped to the_key.
   * @throws RemoteException if something goes wrong with RMI.
   */
  Serializable get(Serializable the_key) throws RemoteException;
  
  /**
   * Empties the map.
   * 
   * @throws RemoteException if something goes wrong with RMI.
   */
  void clear() throws RemoteException;
}
